email me at borlaj@portlandschools.org

Loading
notes previous (10/<10) submit the dump links  
 

Paintbrush notes:

 

You are going to constantly need to check the coordinates to make sure
they are in bounds (in the canvas) before you draw.
It is going to get tedious to keep saying if (x>100 && x<400 && y>100 & y<400 && x2...)
We might write a function (same as method) to check if we are in bounds:

public boolean isInCanvas(int x, int y)
{
   //check x and y make sure its in canvas
   return true if in canvas
   return false otherwise
}
            

now before we draw we would say something like

if (isInCanvas(x,y) && isInCanvas(x2,y2))
            //that would mean that both x,y and x2,y2 are in the canvas region.